<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <title>Title</title>
    <style>
        body, table, tr, th, td {
            font-family: "Microsoft YaHei UI";
            font-size: 12px;
        }
    </style>
</head>
<body>
<h1>marco指令</h1>
<ul>
    <li>1 无参的marco指令</li>
    <#macro test>
    <font color="red">我是无参的marco</font>
</#macro>
<@test />
    <li>2 有参的marco指令</li>
    <#macro test p1 p2>
    <font color="red">我是有参的marco,p1=${p1},p2=${p2}</font>
</#macro>
<@test p1="java" p2="python"/>
    <li>3 有参的marco指令</li>
    <#macro test p1 p2="hello python">
    <font color="red">我是有默认参的marco,p1=${p1},p2=${p2}</font>
</#macro>
<@test p1="java"/>
    <li>4 有多个参数的marco指令</li>
    <#macro test p1 p2="hello python" pExt...>
    <font color="red">我有多个参数的marco,p1=${p1},p2=${p2}</font><br />
    <font color="red">${pExt['p3']}</font><br />
</#macro>
<@test p1="java" p2="python" p3="html"/>
</ul>
<h1>nested</h1>
<ul>
    <!--使用marco函数定义test1方法 p1默认值html-->
    <#macro test1 p1="html">
        ${p1}<br />
        <#nested p1,"我是nested参数" > <br />
    </#macro>
    <li>
        调用
    </li>
    <div>
        <!--调用test1方法，loopVar1，loopVar2是nested调用参数-->
        <@test1 p1="java";loopVar1,loopVar2>
        <font color="red">hello ${loopVar1},${loopVar2}</font><br />
    </@test1>
    <!--调用test1方法-->
        <@test1 p1="python";loopVar1>
        hello ${loopVar1}<br />
    </@test1>
    </div>
</ul>
<ul>
    <h2>3 函数</h2>
    <#function doAdd p1 p2>
        <#return p1+p2>
    </#function>
    <li>调用</li>
    你好，我是调用${doAdd(100,88)}
</ul>
</body>
</html>